<%@page language="java" contentType="text/html; charset=UTF-8" 
	pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<nav class="navbar navbar-default">
	<div class="container-fluid">
		<!-- Brand and toggle get grouped for better mobile display -->
		<div class="navbar-header">
			<button type="button" class="navbar-toggle collapsed"
				data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
				<span class="sr-only">Toggle navigation</span>
				<span class="icon-bar"></span> 
				<span class="icon-bar"></span> 
				<span class="icon-bar"></span>
			</button>
			<a class="navbar-brand" href="#">VD</a>
		</div>

		<!-- Collect the nav links, forms, and other content for toggling -->
		<div class="collapse navbar-collapse"
			id="bs-example-navbar-collapse-1">
			<ul class="nav navbar-nav">
				<li class="active">
					<a href="${pageContext.servletContext.contextPath}/countDown">
						<i class="fa fa-home fa-fw"></i>Anasayfa <span class="sr-only">(current)</span>
					</a>
				</li>

				<li><a href="#"><i class="fa fa-calendar-o fa-fw"></i>Gündem</a></li>
				<li><a href="#"><i class="fa fa-comments-o fa-fw"></i>Eğitim</a></li>
				<li><a href="#"><i class="fa fa-building fa-fw"></i>Siyaset</a></li>
				<li><a href="#"><i class="fa fa-life-ring fa-fw"></i>Resmi Tatiller</a></li>
				<li><a href="#"><i class="fa fa-gamepad fa-fw"></i>Oyun</a></li>
			</ul>
			<div class="navbar-form navbar-right">
			<c:if test="${sessionScope.user == null}">
				<button class="btn btn-primary" data-toggle="modal"	data-target="#loginModal">
					<i class="fa fa-user fa-fw"></i> Giriş
				</button>
				<button class="btn btn-primary" data-toggle="modal"	data-target="#registerModal">
					<i class="fa fa-pencil fa-fw"></i>Üye Ol
				</button>
			</c:if>
			<c:if test="${sessionScope.user != null }">
				${sessionScope.user.nameSurname} &nbsp;
				<c:if test="${sessionScope.user.role.roleName == 'admin'}">
					<a href="${pageContext.request.contextPath}/Admin" class="btn btn-primary">
						<i class="fa fa-sign-in fa-fw"></i>Yönetim
					</a> 
				</c:if>
				<a href="${pageContext.request.contextPath}/user/kullaniciAnasayfa.jsp" class="btn btn-primary">
					<i class="fa fa-search-plus fa-fw"></i>Profil
				</a> 
				<a href="${pageContext.request.contextPath}/Logout" class="btn btn-primary">
					<i class="fa fa-power-off fa-fw"></i>Çıkış Yap
				</a> 
			</c:if>
			</div>
		</div>
		<!-- /.navbar-collapse -->
	</div>
	<!-- /.container-fluid -->
</nav>

<div class="modal fade" id="loginModal" tabindex="-1" role="dialog"
	aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog modal-md">
		<div class="modal-content">
			<div class="modal-header text-center">
		<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    	<h4 class="modal-title">Giriş Yap</h4>
  	  </div>
	  <div class="modal-body text-center">
        <form class="form-horizontal" role="form" method="post" action="Login">
          <div class="form-group">
            <div class="col-sm-5 col-sm-offset-3">
              ${hataMesaji}
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-1 col-sm-offset-3 control-label"><span class="glyphicon glyphicon-user"></span></label>
            <div class="col-sm-5">
              <input type="text" name="username" placeholder="Kullanıcı Adı" class="form-control" required="required">
            </div>
          </div>
          <div class="form-group">
            <label class="col-sm-1 col-sm-offset-3 control-label"><span class="glyphicon glyphicon-lock"></span></label>
            <div class="col-sm-5">
              <input type="password" name="password" placeholder="Şifre" class="form-control" required="required">
            </div>
          </div>
          <div class="form-group">
            <div class="col-sm-5 col-sm-offset-4">
              <input type="submit" class="btn btn-primary btn-block" value="Giriş Yap">
            </div>
          </div>
        </form>
      </div>
		</div>
	</div>
</div>
<!-- Login Modal -->
<div class="modal fade" id="registerModal" tabindex="-1" role="dialog"
	aria-labelledby="myModalLabel" aria-hidden="true">
	<div class="modal-dialog">
		<div class="modal-content">
			<div class="modal-header">
				<button type="button" class="close" data-dismiss="modal"
					aria-hidden="true">&times;</button>
				<h4 class="modal-title">Üyelik Formu</h4>
			</div>

			<div class="modal-body">
				<!-- The form is placed inside the body of modal -->
				<form id="loginForm" method="post" class="form-horizontal"
					action="Register">
					<div class="form-group">
						<h3>${kayitHata}</h3>
						<label class="col-xs-3 control-label">Ad Soyad</label>
						<div class="col-xs-5">
							<input type="text" class="form-control" name="nameSurname" />
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-3 control-label">Kullanıcı Adı</label>
						<div class="col-xs-5">
							<input type="text" class="form-control" name="username" />
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-3 control-label">E-Posta</label>
						<div class="col-xs-5">
							<input type="text" class="form-control" name="email" />
						</div>
					</div>

					<div class="form-group">
						<label class="col-xs-3 control-label">Şifre</label>
						<div class="col-xs-5">
							<input type="password" class="form-control" name="password1" />
						</div>
					</div>
					<div class="form-group">
						<label class="col-xs-3 control-label">Şifre Tekrar</label>
						<div class="col-xs-5">
							<input type="password" class="form-control" name="password2" />
						</div>
					</div>

					<div class="form-group">
						<div class="col-xs-5 col-xs-offset-3">
							<button type="submit" class="btn btn-primary btn-block">Üye Ol</button>
						</div>
					</div>
				</form>
			</div>
		</div>
	</div>
</div>
<!-- Register Modal -->